package com.example.aigc_education.ws.handler;

import com.example.aigc_education.integration.request.ChatMessageRequestV2;
import com.example.aigc_education.rpc.api.v2.ChatServiceProto;

public class UserTestMessageHandler extends AbstractMessageHandler{
    @Override
    public ChatMessageRequestV2 handle(ChatServiceProto.ChatMessage chatMessage) {
        return ChatMessageRequestV2.builder()
                .userId(String.valueOf(chatMessage.getUserId()))
                .type(chatMessage.getContents(0).getType())
                .role(ChatMessageRequestV2.Role.USER)
                .content(chatMessage.getContents(0).getText())
                .messageId(chatMessage.getMessageId())
                .convId(String.valueOf(chatMessage.getConvId()))
                .build();
    }

    @Override
    protected int getRole() {
        return ChatServiceProto.Role.HUMAN_VALUE;
    }

    @Override
    protected String getType() {
        return "text";
    }
}
